import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    hislen: window.history.length,
    playstate: false,
    timeStamp: 0,
    audioTimeStamp: 1,
    jumpTimeStamp: 0,
    index: localStorage.getItem('playIndex') ? Number(localStorage.getItem('playIndex')) : 0,
    list: [
      {
        author: '许嵩',
        name: '天龙八部',
        mp3_path: 'mp3/1.mp3',
        img_path: 'mp3/1.jpg',
        lyric: `[ti:天龙八部之宿敌]
        [ar:许嵩]
        [al:264456]
        [by:]
        [offset:0]
        [00:00.00]天龙八部之宿敌 - 许嵩 (Vae Xu)
        [00:05.63]词：许嵩
        [00:11.26]曲：许嵩
        [00:16.89]编曲：蔡庭贵
        [00:22.52]会在何处见到你
        [00:27.38]莫非前尘已注定
        [00:32.14]飞过时空的距离
        [00:37.15]却囿于刀剑光影
        [00:42.10]三月春花渐次醒
        [00:47.14]迢迢年华谁老去
        [00:51.97]是劫是缘随我心
        [00:56.89]除了你万敌不侵
        [01:01.94]当恩怨各一半 我怎么圈揽
        [01:07.15]看灯笼血红染 寻仇已太晚
        [01:12.10]月下门童喟叹 昨夜太平长安
        [01:22.18]当天上星河转 我命已定盘
        [01:26.86]待绝笔墨痕干 宿敌已来犯
        [01:31.87]我借你的孤单 今生恐怕难还
        [01:42.00]
        [02:03.82]缠扰孤岛的雪雨
        [02:08.64]飘飘洒洒谁来停
        [02:13.63]摘取一颗海上星
        [02:18.53]陪我终夜不孤寂
        [02:23.60]灵柩长埋深谷底
        [02:28.51]没有永远的秘密
        [02:33.40]染指江湖结悲局
        [02:38.36]无人逃得过宿命
        [02:43.42]当恩怨各一半 我怎么圈揽
        [02:48.58]看灯笼血红染 寻仇已太晚
        [02:53.54]月下门童喟叹 昨夜太平长安
        [03:03.50]当天上星河转 我命已定盘
        [03:08.36]待绝笔墨痕干 宿敌已来犯
        [03:13.38]我借你的孤单 今生恐怕难还
        [03:23.04]
        [03:25.73]当恩怨各一半 我怎么圈揽
        [03:30.65]看灯笼血红染 寻仇已太晚
        [03:35.71]月下门童喟叹 昨夜太平长安
        [03:45.73]当天上星河转 我命已定盘
        [03:50.49]待绝笔墨痕干 宿敌已来犯
        [03:55.39]我借你的孤单 今生恐怕难还`
      },
      {
        author: '曲肖冰',
        name: '天亮以前说再见',
        mp3_path: 'mp3/2.mp3',
        img_path: 'mp3/2.jpg',
        lyric: `[ti:天亮以前说再见]
        [ar:曲肖冰]
        [al:天亮以前说再见]
        [by:]
        [offset:0]
        [00:00.00]天亮以前说再见 - 曲肖冰
        [00:01.71]词：康梓峰
        [00:03.43]曲：康梓峰
        [00:05.14]编曲：王柏鸿
        [00:06.86]录音：浔浔
        [00:08.58]缩混：张栩赫（Ethan）
        [00:10.29]和声：Kent王健
        [00:12.01]和声编写：Kent王健
        [00:13.72]制作人：浔浔
        [00:15.44]配唱制作人：浔浔
        [00:17.16]录音室：1803 Studio
        [00:18.87]混音室：Hot Music Studio
        [00:20.59]制作团队：KingStar音乐社团/柏鸿工作室
        [00:22.30]企划营销：梦童娱乐
        [00:24.02]监制：三千
        [00:25.74]ＯＰ：千和世纪
        [00:27.46]水花只能开在雨天
        [00:33.38]烟花要绽放在黑夜
        [00:39.38]雪花多舍不得冬天
        [00:45.50]像我舍不得和你说再见
        [00:51.65]谎言并不代表欺骗
        [00:57.41]诺言也不一定兑现
        [01:03.29]誓言就都留给时间
        [01:09.29]就请把从前留在今天
        [01:16.23]天亮以前说再见
        [01:19.11]笑着泪流满面
        [01:22.06]去迎接
        [01:23.17]应该你的
        [01:25.05]更好的明天
        [01:28.08]昙花若只一现
        [01:31.09]更要开的耀眼
        [01:34.11]别回头去拥有
        [01:36.55]属于你更好的世界
        [01:40.12]天亮以前说再见
        [01:43.14]让我留在今天
        [01:46.16]去保护
        [01:47.24]我和你的
        [01:49.26]最好的夏天
        [01:52.11]情丝若水三千
        [01:55.11]只取一瓢眷恋
        [01:57.78]当你来过的纪念
        [02:03.49]水花只能开在雨天
        [02:09.34]烟花要绽放在黑夜
        [02:15.34]雪花多舍不得冬天
        [02:21.31]像我舍不得和你说再见
        [02:27.41]谎言并不代表欺骗
        [02:33.40]诺言也不一定兑现
        [02:39.35]誓言就都留给时间
        [02:45.45]就请把从前留在今天
        [02:52.16]天亮以前说再见
        [02:55.16]笑着泪流满面
        [02:58.20]去迎接
        [02:59.24]应该你的
        [03:01.15]更好的明天
        [03:04.17]昙花若只一现
        [03:07.08]更要开的耀眼
        [03:10.11]别回头去拥有
        [03:12.34]属于你更好的世界
        [03:16.15]天亮以前说再见
        [03:19.12]让我留在今天
        [03:22.13]去保护
        [03:23.24]我和你的
        [03:25.15]最好的夏天
        [03:28.19]情丝若水三千
        [03:31.15]只取一瓢眷恋
        [03:34.05]当你来过的纪念`
      }
    ]
  },
  mutations: {
    setCurrtTamp (state, val) {
      state.timeStamp = val
    },
    setplaystate (state, val) {
      state.playstate = val
    },
    setAudioTamp (state, val) {
      state.audioTimeStamp = val
    },
    setJumpTimeStamp (state, val) {
      state.jumpTimeStamp = val
      state.timeStamp = val
    },
    setPlayIndexValue (state, value) {
      state.index = value
    },
    setPlayIndex (state, flag) {
      var len = state.list.length
      if (flag === '+') {
        if (state.index + 1 < len) {
          state.index++
        } else {
          state.index = 0
        }
      } else {
        if (state.index === 0) {
          state.index = len - 1
        } else {
          state.index--
        }
      }
      localStorage.setItem('playIndex', state.index)
    }
  },
  actions: {
  },
  modules: {
  }
})
